home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995…tember: Reference Library / Dev.CD Sep 95 RL / Dev.CD Sep 95 RL.toast / mac / Technical Documentation / develop / develop Issue 22 code / PCI Driver Sample / NCR_DriverProject / Src / TempDriverGestalt.h < prev   
Encoding:
C/C++ Source or Header  |  1995-03-11  |  6.2 KB  |  201 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        DriverGestalt.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Drivers Development Kit Release.  Friday, October 21, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16. /*
  17.  * Edit History
  18.  * 1995.03.02 MM/AF    Typo - fixed
  19.  */
  20.  
  21. #ifndef __DRIVERGESTALT__
  22. #define __DRIVERGESTALT__
  23.  
  24. /* This used to be defined in Files.h */
  25. #define ParamBlockHeader \
  26.  QElemPtr    qLink;                    /* queue link in header */\
  27.  short        qType;                    /* type byte for safety check */\
  28.  short        ioTrap;                    /* FS: the Trap */\
  29.  Ptr        ioCmdAddr;                /* FS: address to dispatch to */\
  30.  ProcPtr    ioCompletion;              /* completion routine addr (0 for synch calls) */\
  31.  OSErr        ioResult;                /* result code */\
  32.  StringPtr    ioNamePtr;              /* ptr to Vol:FileName string */\
  33.  short        ioVRefNum;               /* volume refnum (DrvNum for Eject and MountVol) */
  34.  
  35. /* The Driver Gestalt bit in the dCtlFlags */
  36.  
  37. enum {
  38.     DriverGestalt_Enable            = 2,
  39.     
  40.     DriverGestalt_Enable_Mask        = (1 << DriverGestalt_Enable)
  41. };
  42.  
  43. /* New csCodes */
  44. enum {
  45.     csDriverGestaltCode        = 43,        /* various uses */
  46.     csDriverConfigureCode    = 43,        /* various uses */
  47.     csSetStartupDrive        = 44,        /* Control call made to a driver when a user selects a drive in the Startup CP */
  48.     csLowPowerMode            = 70,        /* Sets/Returns the current energy consumption level */
  49.     csReturnDeviceID        = 120,        /* returns SCSI DevID in csParam[0] */
  50.     csGetCDDeviceInfo        = 121        /* returns CDDeviceCharacteristics in csParam[0] */
  51. };
  52.  
  53. /* Currently defined drvrGestalt selectors */
  54. enum {
  55.     driverGestaltSync            = 'sync',    /* True if driver only behaves synchronously. */
  56.     driverGestaltBoot            = 'boot',    /* value to place in PRAM for this drive (long) */
  57.     driverGestaltDeviceType        = 'devt',    /* The type of device the driver is driving. */
  58.     driverGestaltInterface        = 'intf',    /* The underlying interface that the driver is using (if any) */
  59.     driverGestaltVersion        = 'vers',    /* Version number of the driver (numeric part of vers resource) */
  60.     driverGestaltStorage        = 'lpwr'    /* The driver supports the new power saving control/status call */
  61. };
  62.  
  63. /* Structures for currently defined drvrGestalt selectors */
  64.  
  65. struct DriverGestaltSyncResponse
  66. {
  67.     Boolean        behavesSynchronously;
  68. };
  69. typedef struct DriverGestaltSyncResponse DriverGestaltSyncResponse;
  70.  
  71. struct DriverGestaltLpwrResponse
  72. {
  73.     Boolean        supportsLowPower;
  74. };
  75. typedef struct DriverGestaltLpwrResponse DriverGestaltLpwrResponse;
  76.  
  77. struct DriverGestaltBootResponse
  78. {
  79.     UInt8    extDev;            /*  Packed target (upper 5 bits) LUN (lower 3 bits) */
  80.     UInt8    partition;        /*  Unused */
  81.     UInt8    SIMSlot;        /*  Slot */
  82.     UInt8    SIMsRSRC;        /*  sRsrcID */
  83. };
  84. typedef struct DriverGestaltBootResponse DriverGestaltBootResponse;
  85.  
  86. struct DriverGestaltDevTResponse
  87. {
  88.     OSType    deviceType;
  89. };
  90. typedef struct DriverGestaltDevTResponse DriverGestaltDevTResponse;
  91.  
  92.     /* Currently defined values:            */
  93.     /*    'disk'    - standard r/w disk drive     */
  94.     /*    'tape'    - tape drive                 */
  95.     /*    'prnt'    - printer                     */
  96.     /*    'proc'    - processor                 */
  97.     /*    'worm'    - write-once                */
  98.     /*    'cdrm'    - cd-rom drive                */
  99.     /*    'flop'    - floppy disk drive            */
  100.     /*    'scan'    - scanner                    */
  101.  
  102.  
  103. struct DriverGestaltIntfResponse
  104. {
  105.     OSType    interfaceType;
  106. };
  107. typedef struct DriverGestaltIntfResponse DriverGestaltIntfResponse;
  108.  
  109.     /* Currently defined values:            */
  110.     /*    'scsi'                                */
  111.     /*    'pcmc'    - pcmcia                    */
  112.     /*    'ide '                                */
  113.     /*    'pci '                                */
  114.     /*    'nbus'    - nubus card                */
  115.  
  116.  
  117. struct DriverGestaltVersResponse
  118. {
  119.     NumVersion driverVersion;
  120. };
  121. typedef struct DriverGestaltVersResponse DriverGestaltVersResponse;
  122.  
  123.  
  124. /* status parameter block for drvrGestalt calls */
  125. struct DriverGestaltParam {
  126.     ParamBlockHeader
  127.     short                ioCRefNum;                /* refNum for I/O operation */
  128.     short                csCode;                    /*    == DriverGestaltCode */
  129.     OSType                driverGestaltSelector;    /* 'sync', 'vers', etc. */
  130.     UInt32                driverGestaltResponse;    /* Could be a pointer, bit field or other format */
  131. };
  132. typedef struct DriverGestaltParam DriverGestaltParam;
  133.  
  134. /* control parameter block for drvrGestalt calls */
  135. struct DriverConfigParam {
  136.     ParamBlockHeader 
  137.     short                ioCRefNum;                /* refNum for I/O operation */
  138.     short                csCode;                    /*    == DriverGestaltCode */
  139.     OSType                driverConfigSelector;    /* the selector */
  140.     UInt32                driverConfigParameter;    /* Could be a pointer, bit field or other format */
  141. };
  142. typedef struct DriverConfigParam DriverConfigParam;
  143.  
  144. /* Power Saving stuff */
  145.  
  146. enum {
  147.     pmActive        = 0,    /* Normal operation */
  148.     pmStandbay        = 1,    /* Minimal energy saving state, can go active in 5s */
  149.     pmIdle            = 2,    /* Substantial energy savings, can go active in 15s */
  150.     pmSleep            = 3        /* Maximum energy savings, device may be turned off */
  151. };
  152.  
  153. struct LowPowerMode
  154. {
  155.     UInt8        mode;
  156. };
  157. typedef struct LowPowerMode LowPowerMode;
  158.  
  159.  
  160. /* CD-ROM Specific cs*/
  161.  
  162. struct CDDeviceCharacteristics
  163. {
  164.     UInt8    speedMajor;            /* High byte of fixed point number containing drive speed */
  165.     UInt8    speedMinor;            /* Low byte of "" CD 300 == 2.2, CD_SC == 1.0 etc. */
  166.     UInt16    cdFeatures;            /* Flags field for features and transport type of this CD-ROM */
  167. };
  168. typedef struct CDDeviceCharacteristics CDDeviceCharacteristics;
  169.  
  170. enum
  171. {
  172.     cdFeatureFlagsMask        = 0xFFFC,    /* The Flags are in the first 14 bits of the cdFeatures field */
  173.     cdTransportMask            = 0x0003    /* The transport type is in the last 2 bits of the cdFeatures field */
  174. };
  175.  
  176. enum    /* Flags for CD Feature Flags field */
  177. {
  178.     cdMute                    = 2,    /* The following flags have the same bit number */
  179.     cdLeftPlusRight            = 3,    /* as the Audio Mode they represent.  Don't change */
  180.     cdSCSI_2                = 10,    /* Supports SCSI2 CD Command Set */
  181.     cdStereoVolume            = 11,    /* Can support two different volumes (1 on each channel) */
  182.     cdDisconnect            = 12,    /* Drive supports disconnect/reconnect */
  183.     cdWriteOnce                = 13,    /* Drive is a write/once (CD-R?) type drive */
  184.  
  185.     cdMute_Mask                = 1 << cdMute,
  186.     cdLeftPlusRight_Mask    = 1 << cdLeftPlusRight,
  187.     cdSCSI_2_Mask            = 1 << cdSCSI_2,
  188.     cdStereoVolume_Mask        = 1 << cdStereoVolume,
  189.     cdDisconnect_Mask        = 1 << cdDisconnect,
  190.     cdWriteOnce_Mask        = 1 << cdWriteOnce
  191. };
  192.  
  193. enum    /* Transport types */
  194. {
  195.     cdCaddy                    = 0,    /* CD_SC,CD_SC_PLUS,CD-300 etc. */
  196.     cdTray                    = 1,    /* CD_300_PLUS etc. */
  197.     cdLid                    = 2     /* Power CD - eg no eject mechanism */
  198. };
  199.  
  200. #endif /* __DRIVERGESTALT__ */
  201.